package com.ruoyi.business.customer.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.ruoyi.business.base.JoBaseService;
import com.ruoyi.business.base.PageParam;
import com.ruoyi.business.customer.domain.JbCustomer;
import com.ruoyi.business.customer.domain.JbCustomerFastSearch;
import com.ruoyi.business.customer.domain.JbCustomerField;
import com.ruoyi.business.customer.domain.dto.JbCustomerDto;
import com.ruoyi.business.customer.domain.dto.JbCustomerListDto;
import com.ruoyi.business.customer.domain.dto.JbCustomerTransferDto;
import com.ruoyi.business.customer.domain.dto.JbCustomerUpdateDto;
import com.ruoyi.business.customer.domain.vo.*;
import com.ruoyi.business.order.domain.JbOrder;
import com.ruoyi.business.rule.domain.JbRules;

import java.util.List;


/**
 * 客户Service接口
 *
 * @author ruoyi
 * @date 2024-10-11
 */
public interface JbCustomerService extends JoBaseService<JbCustomer>
{
    /**
     * 添加
     *
     * @param jbCustomerDto
     * @return
     */
    Long saveInfo(JbCustomerDto jbCustomerDto);

    /**
     * 查询
     *
     * @param iPage
     * @param jbCustomerListDto
     * @return
     */
    IPage<JbCustomerListVo> listData(IPage iPage, JbCustomerListDto jbCustomerListDto);

    /**
     * 查询
     *
     * @param param
     * @param jbCustomerListDto
     * @return
     */
    IPage<JbCustomerListVo> seniorListData(PageParam param, JbCustomerListDto jbCustomerListDto);

    /**
     * app客户查询，待自定义排序
     *
     * @param param
     * @param jbCustomerListDto
     * @return
     */
    IPage<JbCustomerListVo> appSeniorListData(PageParam param, JbCustomerListDto jbCustomerListDto);

    /**
     * 重点客户高级查询
     *
     * @param iPage
     * @param jbCustomerListDto
     * @return
     */
    IPage<JbCustomerListVo> favoriteSeniorListData(IPage iPage, JbCustomerListDto jbCustomerListDto);

    /**
     * 获取客户动态
     *
     * @param iPage
     * @param jbCustomerListDto
     * @return
     */
    IPage<CustomerDynamicListVo> customerDynamicList(IPage iPage, JbCustomerListDto jbCustomerListDto);

    /**
     * 详情
     *
     * @param id
     * @return
     */
    JbCustomerDto detailsInfo(Long id);

    /**
     * 跟新
     *
     * @param jbCustomerUpdateDto
     * @return
     */
    Boolean updateInfoById(JbCustomerUpdateDto jbCustomerUpdateDto);

    /**
     * 修改置顶
     *
     * @param id
     * @return
     */
    Boolean editTopUp(Long id);

    /**
     * 转移客户
     *
     * @param jbCustomerTransferDto
     * @return
     */
    Boolean transferCustomer(JbCustomerTransferDto jbCustomerTransferDto);

    /**
     * 移入公海
     *
     * @param jbCustomerTransferDto
     * @return
     */
    Boolean transferHighSeas(JbCustomerTransferDto jbCustomerTransferDto);

    /**
     * 360客户-概述
     *
     * @param id
     * @return
     */
    JbCustomerOverViewVo overViewInfo(Long id);

    /**
     * 360客户详情
     *
     * @param id
     * @return
     */
    JbCustomerDetailedInforMtionVo detailedInforMtion(Long id);

    /**
     * 归属记录
     *
     * @param jbCustomer
     * @return
     */
    IPage<JbCustomerBelongToRecordVo> belongToRecord(IPage iPage, JbCustomer jbCustomer);

    /**
     * 客户自动分配规则自动执行
     *
     * @param one
     */
    void deptHighseasAllocation(JbRules one);

    /**
     * 360-作物结构
     *
     * @param id
     */
    List<JbCustomerCropStructureStatistics> cropStructure(Long id);

    /**
     * 360-销售结构
     *
     * @param id
     */
    List<JbCustomerSalesStatistics> saleScale(Long id);

    /**
     * 客户360订单分析
     *
     * @param id
     * @param year
     * @return
     */
    List<JbOrder> orderAnalysis(Long id, String year);

    /**
     * 客户的订单历史记录
     *
     * @param id
     * @param year
     * @return
     */
    IPage<JbOrder> orderRecord(IPage iPage, Long id, String year);

    /**
     * 客户的产品统计
     *
     * @param id
     * @param year
     * @return
     */
    IPage<JbCustomerProductStatistics> orderAnalysisProduct(Long id, String year, PageParam page);

    /**
     * 客户按月份统计订单数据
     *
     * @param id
     * @param year
     * @return
     */
    List<JbCustomerMonthStatistics> orderAnalysisMonth(Long id, Integer year, String orderBy);

    /**
     * 判断客户手机号，是否有订单
     *
     * @param phone
     * @return
     */
    Integer customerIsExist(String phone);

    /**
     * 获取高级筛选的字段
     *
     * @return
     */
    List<JbCustomerField> setFieldList();

    /**
     * 添加或修改设置的字段
     *
     * @param jbCustomerFields
     * @return
     */
    Boolean setFieldSave(List<JbCustomerField> jbCustomerFields);

    /**
     * 快速设置天添加和修改
     *
     * @param jbCustomerFastSearch
     * @return
     */
    Boolean fastSearchSave(JbCustomerFastSearch jbCustomerFastSearch);

    /**
     * 快速设置天置顶
     *
     * @param id
     * @return
     */
    Boolean fastTopUp(Long id);

    /**
     * 快速设置删除
     *
     * @param id
     * @return
     */
    Boolean fastSearchDel(Long id);

    /**
     * 获取高级筛选快速数据
     *
     * @return
     */
    List<JbCustomerFastSearch> fastSearchList();

    /**
     * 详情
     *
     * @param id
     * @return
     */
    JbCustomerFastSearch fastSearchInfo(Long id);

    /**
     * app 详情的更多统计
     *
     * @param id
     * @return
     */
    JbCustomerOverViewVo detailsMore(Long id);

    /**
     * 导入
     *
     * @param jbCustomerExcle
     * @return
     */
    Boolean importData(List<JbCustomerExcle> jbCustomerExcle);
}
